The present invention relates to optical media, and more particularly to the reading of data from an optical media.
Data retrieved from an optical media, such as a Compact Disc-Writable (CD-W) or a Compact Disc-Rewritable (CD-RW), need to be decoded by a controller of the optical drive before the data may be used. In the CD decoding process, every 2352 bytes of the data stream is defined as a sector. FIG. 1A illustrates a conventional structure of the sectors from a data stream. The sectors include data sectors 102 which contain the actual data. Preceding the data sectors 102 are four Read In (RI) sectors 104. Following the data sectors 102 are two Read Out (RO) sectors 106 and a link block 108. The RI and RO sectors 104-106 are formed by the power up and power down time, respectively, required by the laser in writing the data sectors 102. The link block 108 is a gap between RO2 of the last data sector 102 and RI1 of the next data sector. Thus, separating each group of data sectors 104 are seven link sectors, comprising the RO sectors 106, the link block 108, and the RI sectors 104.
FIG. 1B illustrates the conventional structure of each sector in a data stream. Each sector contains a sync field 110, a header field 112, and a data field 114. The sync field 110 is a fixed twelve byte pattern used to separate the sectors and which can be detected by a Sector Sync Detector of the decoder to maintain synchronization with the beginning of the each sector. The header field 112 specifies the sector address 116 and the sector mode 118. The sector mode 118 has a 3-bit sub-field which indicates the block type. There are eight different types of sectors for CD-R or CD-RW media, as set forth in Table 1 below. Only the Data Block sectors are part of the actual data sectors 102. The rest of the seven types are referred to as link sectors 104-108 which indicate the logical gap between the actual data sectors 102.
When reading CD-R or CD-RW media, the sector address 116 for a data sector 102 is always incremental from the previous data sector. However, for the link sectors 104-108, the sector address 116 can be in either incremental or freeze mode across the link sectors 104-108. FIG. 2 illustrates sector addresses for the incremental and freeze modes. The first line 202 indicates the sector type. The second line 204 indicates each sector""s address in the incremental mode. The third line 206 indicates each sector""s address in the freeze mode. The mode is set at the time the sectors are written onto the media. These addresses are used by the decoder to locate the data sector requested by the system. The decoder has a register in which it maintains the next expected sector address, based upon the mode. If the expected sector address does not match the actual sector address, then the integrity of the data is questionable. Appropriate action may then be taken. The structure of the sectors in the data stream illustrated in FIGS. 1A, 1B, and 2 is standard in the industry.
Conventionally, the decoder buffers the data sectors 102 and the link sectors 104-108 and passes them to a host computer without differentiating between the data sectors 102 and the link sectors 104-108. A software on the host computer is then responsible for detecting and handling the link sectors 104-108 and obtaining the data from the data sectors 102. The host has a choice to either discard the link sectors 104-108 or extract some information from them. When the software finds the link sector, it must stop buffering and reread the media to look for and confirm the location of the next data sector. This rereading is very costly in time. Thus, the conventional software approach is inefficient.
Accordingly, there exists a need for an improved method and system for link sector detection and handling for optical media. The method and system should be more efficient than the conventional software approach. The present invention addresses such a need.
The present invention provides an improved method and system for link detection and handling. The method includes detecting one of the plurality of link sectors; generating an interrupt signal; determining a buffer method selection; buffering the plurality of data sectors only, if a link skip buffer method is selected; and buffering the plurality of data sectors and the plurality of link sectors, except for a link block, and allocating a sector in a buffer for the link block, if a link buffer method is selected. The present invention provides a hardware approach to link sector detection and handling. Instead of passing the data to a system software prior to link sector detection, the method and system in accordance with the present invention performs the link sector detection in the controller hardware. When the controller detects the link sectors, it automatically either skips or buffers the link sectors depending upon the configuration of the controller. By performing the link sector detection in hardware, significant processing time is saved.